package com.wgj.android.utils;

import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;

/**
 * Created by Administrator on 2018/1/2.
 */

public class AnimationUtil {

    /**
     * 创建旋转动画
     */
    public static RotateAnimation createRotateAnimation(int fromDegress, int toDegrees, int duration) {
        RotateAnimation animation = new RotateAnimation(fromDegress, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        //动画执行时间
        animation.setDuration(duration);
        animation.setInterpolator(new LinearInterpolator());
        //动画重复次数-1表示不停重复
        animation.setRepeatCount(-1);
        return  animation;
    }
}
